home *** CD-ROM | disk | FTP | other *** search
/ HAM Radio 1997 / HAM Radio 1997.iso / vcls / reswtch2 / reswatch.pas < prev    next >
Pascal/Delphi Source File  |  1996-04-08  |  20KB  |  594 lines

  1. { ----------------------------------------------------------------------------}
  2. { ResWatch Resource Watcher Version 2.0.                              }
  3. { Copyright 1995, Curtis White.  All Rights Reserved.                         }
  4. { This program can be freely used and distributed in commercial and private }
  5. { environments, provied this notice is not modified in any way.               }
  6. { ----------------------------------------------------------------------------}
  7. { Feel free to contact me if you have any questions, comments or suggestions  }
  8. { at cwhite@teleport.com                                                      }
  9. { ----------------------------------------------------------------------------}
  10. { Date last modified:  08/03/95                                               }
  11. { ----------------------------------------------------------------------------}
  12. { ----------------------------------------------------------------------------}
  13. { ResWatch v2.00                                                         }
  14. { ----------------------------------------------------------------------------}
  15. { Description:                                                                }
  16. {   A graphical resource monitor                                   }
  17. { Features:                                                                   }
  18. {   Monitor system resources.                               }
  19. {   Monitor other system information.                    }
  20. { ----------------------------------------------------------------------------}
  21. { ----------------------------------------------------------------------------}
  22. { Revision History:                                                           }
  23. { 1.00:  Initial release                                                    }
  24. { 2.00:  Re-write to add more functionality as well        }
  25. {           as a nicer look.                                                  }
  26. { ----------------------------------------------------------------------------}
  27.  
  28. { Note:  This program uses a component that I wrote to        }
  29. {            obtain a bunch of system information.  I will be       }
  30. {            releasing this component as soon as I finish the     } 
  31. {            documentation for it.  Keep watching.                       }
  32.  
  33. { Note2:  This program may need modifications to run         }
  34. {              properly under Windows 95, since some of the    }
  35. {              resource calls may have been changed.               }
  36.  
  37.  
  38. unit Reswatch;
  39.  
  40. {
  41.   TForm3D Class
  42.   Copyright ⌐ 1995  Alan Ciemian  All Rights Reserved
  43.  
  44.   The TForm3D class is a descendant of TForm that provides
  45.     3D borders for non-dialog forms and allows form sizing to be
  46.     enabled/disabled by modifying a run-time property.
  47.  
  48.   NOTES:
  49.       - Requires that form have bsSizeable border style.
  50.       - Sizing can be enabled/disabled with AllowResize property.
  51.       - Handles all Title bar icon combinations.
  52.       - Handles forms with or without menus(including multiline).
  53.       - Handles all combinations of scroll bars.
  54.  
  55.   05/01/95 - Initial Release
  56. }
  57.  
  58.  
  59. interface
  60.  
  61. uses
  62.   Messages, WinTypes,
  63.   Classes, Controls, Forms, Dialogs, Sysinfo, ExtCtrls, Gauges, StdCtrls,
  64.   Buttons, SysUtils, RWAbout;
  65.  
  66.  
  67. const
  68.   CaptionH_STD = 20;
  69.   MenuH_STD    = 18;
  70.  
  71.  
  72. type
  73.   TForm3D_NCPaintMode =
  74.     (
  75.     NCPaint_All,
  76.     NCPaint_Activate,
  77.     NCPaint_Deactivate
  78.     );
  79.  
  80. type
  81.   TRWMain = class(TForm)
  82.     RWMainPanel: TPanel;
  83.     FreeMemLabel: TLabel;
  84.     FreeMemSize: TLabel;
  85.     ContigFreeLabel: TLabel;
  86.     ContigFreeSize: TLabel;
  87.     Panel4: TPanel;
  88.     Panel5: TPanel;
  89.     SystemPanel: TPanel;
  90.     SystemGauge: TGauge;
  91.     GDIPanel: TPanel;
  92.     GDIGauge: TGauge;
  93.     UserPanel: TPanel;
  94.     UserGauge: TGauge;
  95.     Panel6: TPanel;
  96.     CPULabel: TLabel;
  97.     WinVerLabel: TLabel;
  98.     DosVerLabel: TLabel;
  99.     TasksLabel: TLabel;
  100.     ResourceTimer: TTimer;
  101.     SystemInfo1: TSystemInfo;
  102.     AboutButton: TBitBtn;
  103.     procedure ResourceTimerTimer(Sender: TObject);
  104.     procedure FormCreate(Sender: TObject);
  105.     procedure AboutButtonClick(Sender: TObject);
  106.   private
  107.     FAllowResize : Boolean;
  108.     FSysMenuW    : Integer;  { Width of system menu,     0 if no sysmenu }
  109.     FMinMaxW     : Integer;  { Width of min/max buttons, 0 if no min/max btns }
  110.     { Private procedures }
  111.     procedure NCPaint3D(const Mode: TForm3D_NCPaintMode);
  112.     procedure ComputeNonClientDimensions;
  113.     function ScrollBarVisible
  114.       (
  115.       const Code    : Word;  { SB_VERT or SB_HORZ }
  116.       const WndRect : TRect
  117.       ): Boolean;
  118.     { Message Handlers }
  119.     procedure WMNCHitTest (var Msg: TWMNCHitTest);  message WM_NCHitTest;
  120.     procedure WMNCPaint   (var Msg: TWMNCPaint);    message WM_NCPaint;
  121.     procedure WMNCActivate(var Msg: TWMNCActivate); message WM_NCActivate;
  122.   protected
  123.     procedure CreateWnd; override;
  124.   public
  125.     constructor Create(AOwner: TComponent); override;
  126.     { Properties }
  127.     property AllowResize: Boolean
  128.              read FAllowResize
  129.              write FAllowResize
  130.              default False;
  131.   end;
  132.  
  133. var
  134.   RWMain: TRWMain;
  135.  
  136. implementation
  137.  
  138. {$R *.DFM}
  139.  
  140. uses
  141.   WinProcs,
  142.   Graphics,
  143.   SysMet;
  144.  
  145.  
  146. function TRWMain.ScrollBarVisible
  147.   (
  148.   const Code    : Word;  { SB_VERT or SB_HORZ }
  149.   const WndRect : TRect
  150.   ): Boolean;
  151. var
  152.   PtInScroll : TPoint;
  153.   HVis       : Boolean;
  154. begin
  155.   Result := False;
  156.  
  157.   with  WndRect, SysMetrics  do
  158.     begin
  159.     { Determine if Horz scroll bar is visible. Need this for both horz and }
  160.     {   vert scroll bars. }
  161.     { Two checks need to be satisfied, Style identifies scroll bar and }
  162.     {   windows recognizes HitTest in scroll bar. }
  163.     { Hit Test check is required because there are cases when the window }
  164.     {   gets very small that windows decides not to draw the scroll bars }
  165.     {   even though they exist. }
  166.     PtInScroll := Point(Left + Frame.cx + 1, Bottom - Frame.cy - 1);
  167.     HVis := ( ((GetWindowLong(Handle, GWL_STYLE) and WS_HSCROLL) <> 0) and
  168.               (Perform(WM_NCHITTEST, 0, LongInt(PtInScroll)) = HTHSCROLL) );
  169.  
  170.     if ( Code = SB_HORZ ) then
  171.       begin  { Done, return result computed above }
  172.       Result := HVis;
  173.       end
  174.     else
  175.       begin  { Perform same procedure as above for vertical }
  176.       PtInScroll := Point(Right - Frame.cx - 1, Bottom - Frame.cy - 1);
  177.       if ( HVis ) then Dec(PtInScroll.y, HScrollBtn.cy);
  178.       Result := ( ((GetWindowLong(Handle, GWL_STYLE) and WS_VSCROLL) <> 0) and
  179.                   (Perform(WM_NCHITTEST, 0, LongInt(PtInScroll)) = HTVSCROLL) );
  180.       end;
  181.     end;
  182. end;
  183.  
  184.  
  185.  
  186. constructor TRWMain.Create
  187.   (
  188.   AOwner: TComponent
  189.   );
  190. begin
  191.   inherited Create(AOwner);
  192.  
  193.   { Set property defaults }
  194.   FAllowResize := False;
  195. end;
  196.  
  197.  
  198. {
  199.   CreateWnd is overriden so we can force certain properties before
  200.     the window is created, and compute some parameters needed to
  201.     do the 3D non-client drawing.
  202. }
  203. procedure TRWMain.CreateWnd;
  204. var
  205.   AdjustHeight : Integer;
  206. begin
  207.   { Border Style must be bsSizeable }
  208.   BorderStyle := bsSizeable;
  209.  
  210.   { Compute height adjustments for font caption and menu.      }
  211.   { In large fonts video modes the client area would otherwise }
  212.   {   be reduced. }
  213.   AdjustHeight := 0;
  214.   with  SysMetrics  do
  215.     begin
  216.     Inc(AdjustHeight, CaptionH - CaptionH_STD);
  217.     { Note: Only adjusts for a single line menu bar }
  218.     if ( Menu <> nil ) then Inc(AdjustHeight, MenuH - MenuH_STD);
  219.     end;
  220.  
  221.   { Let Form create }
  222.   inherited CreateWnd;
  223.  
  224.   { Enforce the height adjustment }
  225.   Height := Height + AdjustHeight;
  226.  
  227.   { Precompute dimensions of key non-client areas for later use }
  228.   {   in drawing the 3D effects. }
  229.   ComputeNonClientDimensions;
  230. end;
  231.  
  232.  
  233. {
  234. ComputeNonClientDimensions precomputes some dimensions of non-client items
  235.   to avoid doing it repeatedly during painting.
  236. }
  237. procedure TRWMain.ComputeNonClientDimensions;
  238.  
  239.   { We'd like to use the SM_CXSIZE system metrics value for the size of icons }
  240.   {  in the title bar but it is NOT correct for some video drivers/modes }
  241.   function BitmapWidth(const BM_ID: Integer): Integer;
  242.   var
  243.     BM     : THandle;
  244.     BMInfo : WinTypes.TBitmap;
  245.   begin
  246.     BM := LoadBitmap(0, MakeIntResource(BM_ID));
  247.     try
  248.       GetObject(BM, SizeOf(BMInfo), @BMInfo);
  249.       Result := BMInfo.bmWidth;
  250.     finally
  251.       DeleteObject(BM);
  252.     end;
  253.   end;
  254.  
  255. begin
  256.   FSysMenuW := 0;
  257.   if ( biSystemMenu in BorderIcons ) then
  258.     begin
  259.     { Note: Close bitmap contains 2 bitmaps, app close and MDI child close }
  260.     Inc(FSysMenuW, BitmapWidth(OBM_CLOSE) div 2);
  261.     end;
  262.  
  263.   FMinMaxW := 0;
  264.   if ( biMinimize in BorderIcons ) then
  265.     begin
  266.     Inc(FMinMaxW, BitmapWidth(OBM_REDUCE));
  267.     end;
  268.   if ( biMaximize in BorderIcons ) then
  269.     begin
  270.     Inc(FMinMaxW, BitmapWidth(OBM_ZOOM));
  271.     end;
  272. end;
  273.  
  274.  
  275. {
  276. NCPaint3D handles the 3D specific painting for the form.
  277. }
  278. procedure TRWMain.NCPaint3D
  279.   (
  280.   const Mode: TForm3D_NCPaintMode
  281.   );
  282. var
  283.   WndRect     : TRect;
  284.   ClientRect  : TRect;
  285.   ClientH     : Integer;
  286.   ScrollH     : Integer;
  287.   DC          : HDC;
  288.   NCCanvas    : TCanvas;
  289.   Extra       : Integer;
  290.   CaptionRect : TRect;
  291.   TM          : TTextMetric;
  292. begin
  293.   { Get window rect }
  294.   WinProcs.GetWindowRect(Handle, WndRect);
  295.   { Need to know if horz scroll bar present }
  296.   ScrollH := 0;
  297.   if ( ScrollBarVisible(SB_HORZ, WndRect) ) then
  298.     begin
  299.     ScrollH := SysMetrics.HScrollBtn.cy - 1;
  300.     end;
  301.   { Convert window rect to (0, 0) origin }
  302.   with  WndRect  do
  303.     begin
  304.     Right  := Right - Left;
  305.     Left   := 0;
  306.     Bottom := Bottom - Top;
  307.     Top    := 0;
  308.     end;
  309.   WinProcs.GetClientRect(Handle, ClientRect);
  310.   ClientH := ClientRect.Bottom - ClientRect.Top;
  311.   if ( 0 < ClientH ) then Inc(ClientH);
  312.  
  313.   { Get a Window DC and wrap it in a Delphi Canvas }
  314.   DC       := GetWindowDC(Self.Handle);
  315.   NCCanvas := TCanvas.Create;
  316.   NCCanvas.Handle := DC;
  317.   try
  318.     with NCCanvas, WndRect, SysMetrics do
  319.       begin
  320.       if ( Mode = NCPaint_All ) then
  321.         begin
  322.         { Draw Left and Top edges of window frame, outer }
  323.         Pen.Color := clBtnShadow;
  324.         PolyLine([ Point(Left,  Bottom - 1),
  325.                    Point(Left,  Top),
  326.                    Point(Right, Top) ]);
  327.         { Draw Bottom and Right edges of window frame, outer }
  328.         Pen.Color := clWindowFrame;
  329.         PolyLine([ Point(Left,  Bottom - 1),
  330.                    Point(Right - 1, Bottom - 1),
  331.                    Point(Right - 1, Top - 1) ]);
  332.         { Draw Left and Top edges of window frame, 1-pixel in }
  333.         Pen.Color := clBtnHighlight;
  334.         PolyLine([ Point(Left  + 1, Bottom - 2),
  335.                    Point(Left  + 1, Top    + 1),
  336.                    Point(Right - 1, Top    + 1) ]);
  337.         { Draw Right and Bottom edges of window frame, 1-pixel in }
  338.         Pen.Color := clBtnShadow;
  339.         PolyLine([ Point(Left  + 1, Bottom - 2),
  340.                    Point(Right - 2, Bottom - 2),
  341.                    Point(Right - 2, Top) ]);
  342.  
  343.         { Fill Remainder of Sizing border }
  344.         Pen.Color := clBtnFace;
  345.         for Extra := 2 to (Frame.cx - 1) do
  346.           begin
  347.           Brush.Color := clBtnFace;
  348.           FrameRect(Rect(Left + Extra, Top + Extra,
  349.                          Right - Extra, Bottom - Extra));
  350.           end;
  351.  
  352.         { Draw Left and Top Edge of Caption Area }
  353.         Pen.Color := clBtnShadow;
  354.         PolyLine([ Point(Frame.cx - 1, Bottom - 1 - Frame.cy - ClientH - ScrollH),
  355.                    Point(Frame.cx - 1, Frame.cy - 1),
  356.                    Point(Right - Frame.cx, Frame.cy - 1) ]);
  357.         { Draw Bottom and Right Edge of Caption Area }
  358.         Pen.Color := clBtnHighlight;
  359.         PolyLine([ Point(Frame.cx - 1,     Bottom - Frame.cy - ClientH - ScrollH),
  360.                    Point(Right - Frame.cx, Bottom - Frame.cy - ClientH - ScrollH),
  361.                    Point(Right - Frame.cx, Frame.cy - 1) ]);
  362.         end;
  363.  
  364.       { Draw Caption }
  365.       CaptionRect := Rect(Frame.cx + FSysMenuW + 1, Frame.cy,
  366.                           Right - Frame.cx - FMinMaxW,
  367.                           Frame.cy - 1 + CaptionH - 1);
  368.       if ( (Mode = NCPaint_Activate) or
  369.            ((Mode = NCPaint_All) and (GetActiveWindow = Self.Handle)) ) then
  370.         begin  { Need 'Active' Caption }
  371.         Brush.Color := clActiveCaption;
  372.         Font.Color  := clCaptionText;
  373.         end
  374.       else
  375.         begin  { Need 'InActive' Caption }
  376.         Brush.Color := clInactiveCaption;
  377.         Font.Color  := clInactiveCaptionText;
  378.         end;
  379.       FillRect(CaptionRect);
  380.       SetTextAlign(DC, TA_CENTER or TA_TOP);
  381.       GetTextMetrics(DC, TM);
  382.       TextRect(CaptionRect,
  383.                (CaptionRect.Left + CaptionRect.Right) div 2,
  384.                CaptionRect.Top + ((CaptionH - 1) - TM.tmHeight) div 2,
  385.                Caption);
  386.       end;
  387.   finally
  388.     NCCanvas.Free;
  389.     ReleaseDC(Handle, DC);
  390.   end; { try-finally }
  391. end;
  392.  
  393.  
  394. {
  395. WMNCHitTest handles the WM_NCHITTEST message.
  396. Modifies sizing hit codes to support fixed size windows.
  397. }
  398. procedure TRWMain.WMNCHitTest
  399.   (
  400.   var Msg: TWMNCHitTest
  401.   );
  402. var
  403.   HitCode : LongInt;
  404. begin
  405.   inherited;
  406.   HitCode := Msg.Result;
  407.  
  408.   { Lets resurrect the size corner }
  409.   if ( HitCode = HTSIZE ) then HitCode := HTBOTTOMRIGHT;
  410.  
  411.   if ( not AllowResize ) then
  412.     begin
  413.     if ( (HitCode = HTLEFT)     or (HitCode = HTRIGHT)      or
  414.          (HitCode = HTTOP)      or (HitCode = HTBOTTOM)     or
  415.          (HitCode = HTTOPLEFT)  or (HitCode = HTBOTTOMLEFT) or
  416.          (HitCode = HTTOPRIGHT) or (HitCode = HTBOTTOMRIGHT) ) then
  417.       begin
  418.       HitCode := HTNOWHERE;
  419.       end;
  420.     end;
  421.  
  422.   Msg.Result := HitCode;
  423. end;
  424.  
  425.  
  426. {
  427. WMNCPaint handles WM_NCPAINT message.
  428. Calls default handler to paint non-client areas that have standard appearance.
  429. Calls NCPaint3D to paint modified non-client areas
  430. NOTE: Uses undocumented aspect of WM_NCPAINT message which allows a clipping
  431.       region handle to be passed in the wParam of the message.
  432.       This is used to avoid seeing the standard non-client areas flash before
  433.       they are repainted by the 3D code.
  434.       Ref. Undocumented Windows pg. 527, Thanks Andrew.
  435. }
  436. procedure TRWMain.WMNCPaint
  437.   (
  438.   var Msg: TWMNCPaint
  439.   );
  440. var
  441.   WndRect    : TRect;
  442.   ClientRect : TRect;
  443.   ClientH    : Integer;
  444.   ScrollH    : Integer;
  445.   ClipRect   : TRect;
  446.   ClipRgn    : THandle;
  447.   HScrollVis : Boolean;
  448.   VScrollVis : Boolean;
  449. begin
  450.   { Let Windows draw the non-client areas that will not change }
  451.   { Form props for window pos and size incorrect during resize here. }
  452.   { Get Position directly from windows }
  453.   WinProcs.GetWindowRect(Handle, WndRect);
  454.   WinProcs.GetClientRect(Handle, ClientRect);
  455.   ClientH := ClientRect.Bottom - ClientRect.Top;
  456.   if ( 0 < ClientH ) then Inc(ClientH);
  457.  
  458.   HScrollVis := ScrollBarVisible(SB_HORZ, WndRect);
  459.   VScrollVis := ScrollBarVisible(SB_VERT, WndRect);
  460.  
  461.   ScrollH := 0;
  462.   if ( HScrollVis ) then ScrollH := SysMetrics.HScrollBtn.cy - 1;
  463.  
  464.   with  WndRect, SysMetrics  do
  465.     begin
  466.     { System Menu }
  467.     if ( biSystemMenu in BorderIcons ) then
  468.       begin
  469.       ClipRect := Rect(Left + Frame.cx, Top + Frame.cy,
  470.                        Left + Frame.cx + TitleBitmap.cx + 1,
  471.                        Top  + Frame.cy + TitleBitmap.cy);
  472.       ClipRgn := CreateRectRgnIndirect(ClipRect);
  473.       TMessage(Msg).wParam := ClipRgn;
  474.       (self as TWinControl).DefaultHandler(Msg);
  475.       DeleteObject(ClipRgn);
  476.       end;
  477.     { Min/Max buttons }
  478.     if ( 0 < FMinMaxW ) then
  479.       begin
  480.       ClipRect := Rect(Right - Frame.cx - FMinMaxW, Top  + Frame.cy,
  481.                        Right - Frame.cx, Top + Frame.cy + TitleBitmap.cy);
  482.       ClipRgn := CreateRectRgnIndirect(ClipRect);
  483.       TMessage(Msg).wParam := ClipRgn;
  484.       (self as TWinControl).DefaultHandler(Msg);
  485.       DeleteObject(ClipRgn);
  486.       end;
  487.     { Menubar }
  488.     if ( Menu <> nil ) then
  489.       begin
  490.       ClipRect := Rect(Left + Frame.cx, Top + Frame.cy + CaptionH - Border.cy - 1,
  491.                        Right - Frame.cx, Bottom - Frame.cy - ClientH - ScrollH);
  492.       ClipRgn := CreateRectRgnIndirect(ClipRect);
  493.       TMessage(Msg).wParam := ClipRgn;
  494.       (self as TWinControl).DefaultHandler(Msg);
  495.       DeleteObject(ClipRgn);
  496.       end;
  497.     end;
  498.  
  499.   { Paint 3-D parts of nonclient area in 3-D style }
  500.   NCPaint3D(NCPaint_All);
  501.  
  502.   { Now let windows paint scroll bars. Need to wait until here because scroll }
  503.   {   bars take advantage of normal borders for their outer edges and they    }
  504.   {   our trounced in NCPaint3D. }
  505.   with  WndRect, SysMetrics  do
  506.     begin
  507.     if ( HScrollVis ) then
  508.       begin { Let Windows draw horz scroll bar }
  509.       ClipRect := Rect(Left  + (Frame.cx - 1), Bottom - (Frame.cy - 1) - HScrollBtn.cy,
  510.                        Right - (Frame.cx - 1), Bottom - (Frame.cy - 1));
  511.       if ( VScrollVis ) then Dec(ClipRect.Right, VScrollBtn.cx - 1);
  512.       ClipRgn := CreateRectRgnIndirect(ClipRect);
  513.       TMessage(Msg).wParam := ClipRgn;
  514.       (self as TWinControl).DefaultHandler(Msg);
  515.       DeleteObject(ClipRgn);
  516.       end;
  517.     if ( VScrollVis ) then
  518.       begin { Let Windows draw vert scroll bar }
  519.       ClipRect := Rect(Right - (Frame.cx - 1) - VScrollBtn.cx, Bottom - Frame.cy - ClientH - ScrollH,
  520.                        Right - (Frame.cx - 1),                 Bottom - (Frame.cy - 1));
  521.       if ( HScrollVis ) then Dec(ClipRect.Bottom, HScrollBtn.cy - 1);
  522.       ClipRgn := CreateRectRgnIndirect(ClipRect);
  523.       TMessage(Msg).wParam := ClipRgn;
  524.       (self as TWinControl).DefaultHandler(Msg);
  525.       DeleteObject(ClipRgn);
  526.       end;
  527.     if ( HScrollVis and VScrollVis ) then
  528.       begin { Let Windows draw little box in corner }
  529.       ClipRect := Rect(Right - (Frame.cx - 1) - (VScrollBtn.cx - 1),
  530.                        Bottom - (Frame.cy - 1) - (HScrollBtn.cy - 1),
  531.                        Right - (Frame.cx - 1) - 1, Bottom - (Frame.cy - 1) - 1);
  532.       ClipRgn := CreateRectRgnIndirect(ClipRect);
  533.       TMessage(Msg).wParam := ClipRgn;
  534.       (self as TWinControl).DefaultHandler(Msg);
  535.       DeleteObject(ClipRgn);
  536.       end;
  537.     end;
  538.  
  539.   { Now let windows update scroll bars }
  540.   Msg.Result := 0;
  541. end;
  542.  
  543.  
  544. {
  545. WMNCActivate handles the WM_NCACTIVATE message.
  546. Calls NCPaint3D to repaint the caption.
  547. Can NOT let windows have this message or it will trash our 3D borders.
  548. }
  549. procedure TRWMain.WMNCActivate
  550.   (
  551.   var Msg: TWMNCActivate
  552.   );
  553. begin
  554.   if ( Msg.Active ) then
  555.     NCPaint3D(NCPaint_Activate)
  556.   else
  557.     NCPaint3D(NCPaint_Deactivate);
  558.  
  559.   Msg.Result := 1;
  560. end;
  561.  
  562. procedure TRWMain.ResourceTimerTimer(Sender: TObject);
  563. begin
  564.   UserGauge.Progress := SystemInfo1.PcntFreeUserRes;
  565.   GDIGauge.Progress := SystemInfo1.PcntFreeGDIRes;
  566.   SystemGauge.Progress := SystemInfo1.PcntFreeSystemRes;
  567.   FreeMemSize.Caption := IntToStr(SystemInfo1.FreeHeap)+'  bytes';
  568.   ContigFreeSize.Caption := IntToStr(SystemInfo1.ContigFreeHeap)+'  bytes';
  569.   CPULabel.Caption := 'CPU:        '+ SystemInfo1.CPUString;
  570.   WinVerLabel.Caption := 'Win Ver:  '+ SystemInfo1.WindowsVersion;
  571.   DosVerLabel.Caption := 'Dos Ver:  '+ SystemInfo1.DOSVersion;
  572.   TasksLabel.Caption := 'Tasks:      '+ IntToStr(SystemInfo1.TasksRunning);
  573. end;
  574.  
  575. procedure TRWMain.FormCreate(Sender: TObject);
  576. var
  577.   hMenu: THandle;
  578. begin
  579.   Application.HintColor := clAqua;
  580.   Application.HintPause := 0;
  581.   hMenu := GetSystemMenu(Handle, False);
  582.   DeleteMenu(hMenu, 4, MF_BYPOSITION);
  583.   DeleteMenu(hMenu, 2, MF_BYPOSITION);
  584.   DeleteMenu(hMenu, 0, MF_BYPOSITION);
  585.   AboutButton.Caption := '';
  586. end;
  587.  
  588. procedure TRWMain.AboutButtonClick(Sender: TObject);
  589. begin
  590.   RWAboutBox.Show;
  591. end;
  592.  
  593. end.
  594.